#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 12080

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["KAsFrame.HttpAPI/KAsFrame.HttpAPI.csproj", "KAsFrame.HttpAPI/"]
COPY ["KAsFrame.Application.Contracts/KAsFrame.Application.Contracts.csproj", "KAsFrame.Application.Contracts/"]
COPY ["KAsFrame.Domain/KAsFrame.Domain.csproj", "KAsFrame.Domain/"]
COPY ["KAsFrame.DomainShared/KAsFrame.DomainShared.csproj", "KAsFrame.DomainShared/"]
COPY ["KAsFrame.Common/KAsFrame.Common.csproj", "KAsFrame.Common/"]
COPY ["KAsFrame.Application/KAsFrame.Application.csproj", "KAsFrame.Application/"]
RUN dotnet restore "KAsFrame.HttpAPI/KAsFrame.HttpAPI.csproj"
COPY . .
WORKDIR "/src/KAsFrame.HttpAPI"
RUN dotnet build "KAsFrame.HttpAPI.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "KAsFrame.HttpAPI.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "KAsFrame.HttpAPI.dll"]